<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" template="/layout/template.xhtml">
	<ui:define name="body">
	<script language="JavaScript" type="text/javascript">
		window.history.forward(-1);
	</script>
		<h1 class="title ui-widget-header ui-corner-all">#{message['permiso.personal.panel']}</h1>
		<h:form id="formPermisos">
			<p:messages id="message" showDetail="true" />
			<p:panel>
				<p:fieldset legend="#{message['permiso.busqueda.empleado']}">
					<h:panelGrid columns="6">
					
					<p:outputLabel value="#{message['permiso.personal.cargo']}" for="cargo"/>
					<p:selectOneMenu id="cargo" value="#{comboAction.cargoEmpleado}" >
					<f:selectItem itemLabel="Seleccione cargo" itemValue="#{null}" />
					<f:selectItems  value="#{comboAction.cargoEmpleadoItems}" />
					<p:ajax update="empleado"  listener="#{comboAction.cambiar2}" />
					</p:selectOneMenu>
					
					<p:outputLabel  value="#{message['permiso.personal.Empleado']}" for="empleado"/>
					<p:selectOneMenu id="empleado" value="#{permiso.idempleado}" required="true">
					<f:selectItems  value="#{comboAction.empleadoxcargo}" />
					</p:selectOneMenu>
					
					<p:commandButton action="#{permiso.agregarListas}" value="#{message['permiso.ver.permiso']}" ajax="false" update="formPermisos"/>
					
					</h:panelGrid>
					
				<p:spacer width="40px" /> 
				
				<p:pickList id="pojoPickList1" value="#{permiso.permisos}" var="e" effect="bounce"  
                    itemValue="#{e}" itemLabel="#{e.nombrePermiso}" converter="permisoConverter"  
                    showSourceControls="true" showTargetControls="true" showCheckbox="true"  
                    addLabel="Agregar" addAllLabel="Agregar todos" removeLabel="Quitar" removeAllLabel="Quitar todos"
                    moveBottomLabel="mover al final" moveDownLabel="Mover abajo" moveTopLabel="mover primero" moveUpLabel="Mover Arriba"
                    showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" >  
                    <f:facet name="sourceCaption">Permisos</f:facet>
                    <f:facet name="targetCaption">Seleccionados</f:facet> 
                    <p:column> #{e.nombrePermiso}</p:column>
                </p:pickList>
				<br/> 
				<h:panelGrid columns="3" >
				<p:spacer/>
				<p:commandButton  action="#{permiso.insertar}" value="#{message['permiso.registrar']}" ajax="false" update="formPermisos" icon="ui-icon ui-icon-disk" />
				</h:panelGrid>
		   	</p:fieldset>
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>